Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: How to use java.util.logging in a Java agent?
Feedback Type: Problem
Product Area: Domino Designer on Eclipse (DDE)
Technical Area: Application Development
Platform: Windows
Release: 8.5.3
Reproducible: Always

Hi Java gurus,

I have been trying to get "proper" java logging (using java.util.logging) to work from an agent. I have posted simplified test code below.

When I run the agent, there are no exceptions, but no logging either. Following suggestions discovered on-line, I have modified {Notes}\jvm\lib\security\java.policy and {Notes}\Data\workspace\.config\rcpinstall.properties with no sucess. (Aside: the need to modify these files makes this whole logging method a non-starter for us, but I wanted to at least get this working.)

I admit that I am still climbing the learning curve, but, it looks like we will need to write our own logging.

Thanks for any help.

Grant Lindsay

--
Code:

import lotus.domino.*;
import java.util.logging.*;

public class JavaAgent extends AgentBase {

// Taken from http://www-10.lotus.com/ldd/lewiki.nsf/dx/Java.util.logging_best_practices_XPD622
private static final String CLAZZ_NAME = JavaAgent.class.getName();
// private static final String PKG = JavaAgent.class.getPackage().getName(); // returns null for the agent's "(default package)".
// private static Logger _logger = Logger.getLogger(PKG);
private static Logger _logger = Logger.getLogger(CLAZZ_NAME); // used CLAZZ_NAME instead of PKG, which is null.

public void NotesMain() {
final String METHOD = "NotesMain";
_logger.entering(CLAZZ_NAME, METHOD);

try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

_logger.logp(Level.FINE, CLAZZ_NAME, METHOD, "User: " + session.getEffectiveUserName());

DateTime lastRun = agentContext.getLastRun();
if (lastRun == null) {
_logger.logp(Level.FINE, CLAZZ_NAME, METHOD, "Last Run (GMT): " + "[never]");
} else {
_logger.logp(Level.FINE, CLAZZ_NAME, METHOD, "Last Run (GMT): [" + lastRun.getGMTTime() + "]");
}

_logger.logp(Level.FINER, CLAZZ_NAME, METHOD, "Calling someWork");
this.someWork(1);

_logger.logp(Level.FINER, CLAZZ_NAME, METHOD, "Back from someWork");

} catch (Exception e) {
// _logger.logp(Level.SEVERE, CLAZZ_NAME, METHOD, "Caught exception", e);
e.printStackTrace();
}
_logger.exiting(CLAZZ_NAME, METHOD);
}

private void someWork(int value) {
final String METHOD = "someWork";
_logger.entering(CLAZZ_NAME, METHOD, new Integer(value));
_logger.logp(Level.INFO, CLAZZ_NAME, METHOD, Integer.toString(++value));
_logger.exiting(CLAZZ_NAME, METHOD);
}
}


Feedback number WEBB8SYKPS created by ~Vanessa Deskiplopflar on 04/02/2012

Status: Open
Comments:

How to use java.util.logging in a J... (~Vanessa Deskip... 2.Apr.12)
. . possible reasons (~Anita Elrevitc... 2.Apr.12)
. . . . Answers (~Vanessa Deskip... 2.Apr.12)
. . . . . . re (~Anita Elrevitc... 2.Apr.12)
. . . . . . . . Still no joy. (~Vanessa Deskip... 2.Apr.12)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS